#include <stdio.h>
#include <stdlib.h>

int campus(const void *a, const void *b) {
	return (*(int *)a - * (int *)b);
}

int main(void) {
	int arr[1200];
	int n;
	int sum = 0;
	double score;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &arr[i]);
	}
	qsort(arr, n, sizeof(int), campus);
	for (int i = 1; i < n - 1; i++) {
		sum += arr[i];
	}
	score = sum * 1.0 / (n - 2);
	printf("%.2lf", score);
	return 0;
}